CMAKE_MINIMUM_REQUIRED(VERSION 3.10)
PROJECT(Behavior)

include_directories(./inc)

aux_source_directory(src _SOURCES)
set(CODE_SOURCES ${CODE_SOURCES} ${_SOURCES})
################################
aux_source_directory(src/agent _SOURCES)
set(CODE_SOURCES ${CODE_SOURCES} ${_SOURCES})

###################################
aux_source_directory(src/behaviortree _SOURCES)
set(CODE_SOURCES ${CODE_SOURCES} ${_SOURCES})
aux_source_directory(src/behaviortree/attachments _SOURCES)
set(CODE_SOURCES ${CODE_SOURCES} ${_SOURCES})
aux_source_directory(src/behaviortree/nodes/actions _SOURCES)
set(CODE_SOURCES ${CODE_SOURCES} ${_SOURCES})
aux_source_directory(src/behaviortree/nodes/composites _SOURCES)
set(CODE_SOURCES ${CODE_SOURCES} ${_SOURCES})
aux_source_directory(src/behaviortree/nodes/conditions _SOURCES)
set(CODE_SOURCES ${CODE_SOURCES} ${_SOURCES})
aux_source_directory(src/behaviortree/nodes/decorators _SOURCES)
set(CODE_SOURCES ${CODE_SOURCES} ${_SOURCES})

###################################
aux_source_directory(src/common _SOURCES)
set(CODE_SOURCES ${CODE_SOURCES} ${_SOURCES})
aux_source_directory(src/common/file _SOURCES)
set(CODE_SOURCES ${CODE_SOURCES} ${_SOURCES})
aux_source_directory(src/common/logger _SOURCES)
set(CODE_SOURCES ${CODE_SOURCES} ${_SOURCES})
aux_source_directory(src/common/memory _SOURCES)
set(CODE_SOURCES ${CODE_SOURCES} ${_SOURCES})
aux_source_directory(src/common/object _SOURCES)
set(CODE_SOURCES ${CODE_SOURCES} ${_SOURCES})
aux_source_directory(src/common/profiler _SOURCES)
set(CODE_SOURCES ${CODE_SOURCES} ${_SOURCES})
aux_source_directory(src/common/randomgenerator _SOURCES)
set(CODE_SOURCES ${CODE_SOURCES} ${_SOURCES})
aux_source_directory(src/common/serialization _SOURCES)
set(CODE_SOURCES ${CODE_SOURCES} ${_SOURCES})
aux_source_directory(src/common/socket _SOURCES)
set(CODE_SOURCES ${CODE_SOURCES} ${_SOURCES})
aux_source_directory(src/common/string _SOURCES)
set(CODE_SOURCES ${CODE_SOURCES} ${_SOURCES})
aux_source_directory(src/common/thread _SOURCES)
set(CODE_SOURCES ${CODE_SOURCES} ${_SOURCES})
aux_source_directory(src/common/xml _SOURCES)
set(CODE_SOURCES ${CODE_SOURCES} ${_SOURCES})

###################################################
aux_source_directory(src/fsm _SOURCES)
set(CODE_SOURCES ${CODE_SOURCES} ${_SOURCES})

###################################################
aux_source_directory(src/htn _SOURCES)
set(CODE_SOURCES ${CODE_SOURCES} ${_SOURCES})

###################################################
aux_source_directory(src/network _SOURCES)
set(CODE_SOURCES ${CODE_SOURCES} ${_SOURCES})

###################################################
aux_source_directory(src/property _SOURCES)
set(CODE_SOURCES ${CODE_SOURCES} ${_SOURCES})

if (CMAKE_BUILD_TYPE STREQUAL "Release")

    ADD_LIBRARY(${PROJECT_NAME} STATIC ${CODE_SOURCES})
elseif (CMAKE_BUILD_TYPE STREQUAL "Debug")

    ADD_LIBRARY(${PROJECT_NAME} STATIC ${CODE_SOURCES})
elseif (CMAKE_BUILD_TYPE STREQUAL "DynamicRelease")

    ADD_LIBRARY(${PROJECT_NAME} SHARED ${CODE_SOURCES})
elseif (CMAKE_BUILD_TYPE STREQUAL "DynamicDebug")

    ADD_LIBRARY(${PROJECT_NAME} SHARED ${CODE_SOURCES})
endif ()

# ============================================================================
# Install 配置
# ============================================================================
# 只有动态库版本才需要安装
if (CMAKE_BUILD_TYPE STREQUAL "DynamicRelease")
    install(TARGETS ${PROJECT_NAME}
            LIBRARY DESTINATION "Bin/DynamicRelease"
            RUNTIME DESTINATION "Bin/DynamicRelease"
            ARCHIVE DESTINATION "Bin/DynamicRelease")
elseif(CMAKE_BUILD_TYPE STREQUAL "DynamicDebug")
    install(TARGETS ${PROJECT_NAME}
            LIBRARY DESTINATION "Bin/DynamicDebug"
            RUNTIME DESTINATION "Bin/DynamicDebug"
            ARCHIVE DESTINATION "Bin/DynamicDebug")
endif()

